		<div class="well-sm" id="_#(searchid??)_searchfield" style="padding-left:0px;border-radius:5px; width:#(width??);margin-bottom:20px;">
			<div class="col-xs-8 input-group" style="width: 100%">
			<!-- 简单查询第一组 -->
				<div class="input-group-btn">
					<button data-toggle="dropdown"
						class="btn btn-sx btn-white dropdown-toggle">
						<span id="_#(searchid??)_searchthis1">请选择</span> 
						<i class="fa fa-caret-down"></i>
					</button>

					<ul class="dropdown-menu">
						<li>
							<a href="javascript:void(0)" onclick="_#(searchid??)_changethis('','请选择','',1,'')">
								清空
							</a>
						</li> 
						<li class="divider" style="margin-top:1px;"></li>
						#for(x : col)
							<li>
								<a href="javascript:void(0)" onclick="_#(searchid??)_changethis('#(x.index??)','#(x.name??)','#(x.type??)',1,'#(x.expre??)')">
									#(x.name??)
								</a>
							</li> 
						#end		
					</ul>
				</div>
				<div id="_#(searchid??)_divinput1">
					<input type="text"  id="_#(searchid??)_inputs1" class="form-control" style="margin-left:-3px;"/>
				</div>
				<input type="hidden" id="_#(searchid??)_hides1"/>
				<input type="hidden" id="_#(searchid??)_expre1"/>
				
				<span class="input-group-btn"></span>

			<!-- 简单查询按钮 -->
				<div class="input-group-btn">
					<button class="btn btn-sx btn-white" id="_#(searchid??)_gotoSearch">查询</button>
				</div>
			</div>

		</div>


	<script type="text/javascript">
		var isAutoPage = true;
		#if(jqGrid != null)
    		var jqGridId = "#(jqGrid??)"
    	    $jqGrid = $("#"+jqGridId);
    	#end
		$(function () {
			if(!$jqGrid){
		    	$jqGrid =  $(grid_selector);
		    }
		    $("#_#(searchid??)_gotoSearch").bind("click", function () {
		    	//第一组查询数据库字段名
		    	var key1 = $("#_#(searchid??)_hides1").val();
		    	var expre1 = $("#_#(searchid??)_expre1").val();
		    	//用户输入的第一组查询字段的值
		        var value1 = $("#_#(searchid??)_inputs1").val();
		        var filter = "";
		        if (typeof (_filter) != "undefined") {
		            filter = _filter;
		        }
		        var where = (BasicTool.isEmpty(filter)) ? "" : filter.replace("}", "");
		        if (BasicTool.isNotEmpty(key1) && BasicTool.isNotEmpty(value1)) {
		            if(expre1=='like'){
		            	where += (BasicTool.isEmpty(filter) ? "{" : ",") + "\"" + key1 + " "+ expre1 + "\":\"" +'%'+ value1 + '%' + "\"";
		            }else{
		            	where += (BasicTool.isEmpty(filter) ? "{" : ",") + "\"" + key1 + expre1 + "\":\"" + value1 + "\"";
		            }
		        }


		        if (BasicTool.isNotEmpty(where)) {//&& BasicTool.isEmpty(exwhere)
		            where += "}";
		        }
		       /*  else if (BasicTool.isNotEmpty(where) && BasicTool.isNotEmpty(exwhere)) {
		            where += exwhere.replace("{", ",");
		        }
		        else {
		            where = BasicTool.format(exwhere);
		        } */
		        where = (BasicTool.isEmpty(key1)  && BasicTool.isEmpty(where)) ? "" : encodeURI(where);
		        //exwhere = encodeURI(exwhere);
		        var pageNum = $jqGrid.getGridParam('page');
		        $jqGrid.jqGrid("setGridParam", {datatype:'json', postData: { where: where,exwhere:exwhere }, page: (isAutoPage) ? pageNum : 1 }).trigger("reloadGrid");
		    });
		});
		
		function _#(searchid??)_changethis(key, value, type, num,expre) {
			isAutoPage = false;
		    if (BasicTool.isEmpty(key)) {
		    	_#(searchid??)_resetInput(num);
		    }
		    if (type.indexOf("select_") >= 0) {
		        var code = type.replace("select_", "");
		        $.post("/cache/getSelect", { code: code, num: num,id:"#(searchid??)"}, function (data) {
		            if (data.code === 0) {
		                $("#_#(searchid??)_divinput" + num).html(data.data);
		            }
		        }, "json");
		    }
		    else if (type == "selectDept") {
		        $.post("/cache/getDeptSelect", { num: num  ,id:"#(searchid??)"}, function (data) {
		            if (data.code === 0) {
		                $("#_#(searchid??)_divinput" + num).html(data.data);
		            }
		        }, "json");
		    }
		    else if (type == "selectUser") {
		        $.post("/cache/getUserSelect", { num: num ,id:"#(searchid??)" }, function (data) {
		            if (data.code === 0) {
		                $("#_#(searchid??)_divinput" + num).html(data.data);
		            }
		        }, "json");
		    }
		    else if (type == "selectRole") {
		        $.post("/cache/getRoleSelect", { num: num,id:"#(searchid??)" }, function (data) {
		            if (data.code === 0) {
		                $("#_#(searchid??)_divinput" + num).html(data.data);
		            }
		        }, "json");
		    }
		    else if (type.indexOf("opentree_") >= 0) {
		        var html = "<input type=\"text\"  id=\"_#(searchid??)_inputs" + num + "_INPUT\" class=\"form-control\" style=\"margin-left:-3px;\"/>";
		        html += "<input type=\"hidden\"  id=\"_#(searchid??)_inputs" + num + "\" />";
                $("#_#(searchid??)_divinput" + num).html(html);
                
		        $("#_#(searchid??)_inputs" + num + "_INPUT").bind("click",function(){
		        	_#(searchid??)_openTree(type,"_#(searchid??)_inputs" + num,"请选择");
		        });
		    }
		    else if (type == "date") {
		    	$("#_#(searchid??)_divinput" + num).html("<input type=\"datetime-local\"  id=\"_#(searchid??)_inputs" + num + "\" class=\"form-control\" style=\"margin-left:-3px;\"/>");
		    }else if (type == "laydate"){
		    	$("#_#(searchid??)_divinput" + num).html("<input  type=\"text\" id=\"_#(searchid??)_inputs" + num + "\" class=\"form-control\" placeholder=\"请输入日期\" value=\" \" onclick=\"_#(searchid??)_getlaydate("+num+")\"/>");
		    }
		    else if (type == "text") {
		    	_#(searchid??)_resetInput(num);
		    }
		    $("#_#(searchid??)_hides" + num).val(key);
		    $("#_#(searchid??)_expre" + num).val(expre);
		    $("#_#(searchid??)_searchthis" + num).html(value);
		}
		
		
		function _#(searchid??)_resetInput(num) {
		    $("#_#(searchid??)_divinput" + num).html("<input type=\"text\"  id=\"_#(searchid??)_inputs" + num + "\" class=\"form-control\" style=\"margin-left:-3px;\"/>");
		}
		
		function _#(searchid??)_openTree(type,index,name){
			layer.open({
        	    type: 2,
        	    title:"树形选择",
        	    area: ["250", "420px"],
        	    fix: false, //不固定
        	    maxmin: true,
        	    content: "/ztree/open/"+type+"/"+index+"/"+name+"/0/radio/0"
        	});
		}
		function _#(searchid??)_getlaydate(num){
			var _elem="_#(searchid??)_inputs"+num;
			laydate.render({
			    elem: '#'+_elem,
			    type: 'datetime',
			    format: 'yyyy-MM-dd HH:mm:ss',
			    change: function(value, date, endDate){
			    	 console.log(value); //得到日期生成的值，如：2017-08-18
				     console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
				     console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。对象成员同上。
			    }
			});
		}
		
	</script>
<script src="/static/laydate/laydate.js"></script>	